package cn.heyige.backend.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("chat_history")
public class ChatHistoryDO {
    
    @TableId(type = IdType.AUTO)
    private Integer id;
    
    @TableField("user_id")
    private Integer userId;
    
    @TableField("session_id")
    private String sessionId;
    
    @TableField("role")
    private String role;
    
    @TableField("content")
    private String content;
    
    @TableField("model")
    private String model;
    
    @TableField("tokens")
    private Integer tokens = 0;
    
    @TableField("is_deleted")
    @TableLogic
    private Boolean isDeleted = false;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    
    public enum Role {
        USER,       // 用户
        ASSISTANT,  // 助手
        SYSTEM      // 系统
    }
}